﻿package com.javaPattern.Decorator;

public class Decorate implements Component {
	private Component decorate;

	// 被装饰对象从装饰器的构造函数中传进来
	public Decorate(Component decorate) {
		this.decorate = decorate;
	}

	// 在基类装饰器中只调用被装饰对象的方法
	@Override
	public void sayHello() {
		if (decorate != null)
			decorate.sayHello();
	}

}
